// ml:run = $bin < input
#include <iostream>
#include <algorithm>
#include <string>

int n, p;
bool in;
int count, max;
std::string s;

bool get_word()
{
    if (p >= n) return false;
    int len = 0;
    for (; p < n; p++)
        if (s[p] == '(') {
            max = std::max(max, len);
            in = true;
            p++;
            return true;
        } else if (s[p] == ')') {
            if (len > 0) count++;
            in = false;
            p++;
            return true;
        } else if (s[p] == '_') {
            if (in && len > 0) count++;
            if (!in) max = std::max(max, len);
            p++;
            return true;
        } else {
            len++;
        }
    max = std::max(max, len);
    return p < n;
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin >> n >> s;
    while (get_word());
    std::cout << max << " " << count << "\n";
}

